// 这个文件当做路由表
import { lazy, Suspense } from "react";
import { Navigate } from "react-router-dom";

// import Home from "../pages/Index";
// import About from "../pages/About";

const Home = lazy(() => import("../pages/Index"));
const About = lazy(() => import("../pages/About"));

const routes = [
  {
    path: "/",
    element: <Navigate to="/home"></Navigate>,
  },
  {
    path: "/home",
    element: (
      <Suspense fallback={<div>loading...</div>}>
        <Home />
      </Suspense>
    ),
  },
  {
    path: "/about",
    element: (
      <Suspense fallback={<div>loading...</div>}>
        <About />
      </Suspense>
    ),
  },
];

export default routes;
